import React, { Component } from 'react';
import { Input, InputNumber } from 'antd';

class TextInput extends Component {
  render() {
    const { getData, onChange, value } = this.props;
    const placeholder = getData('placeholder');
    const type = getData('type');
    const options = { onChange, value, style: { width: '100%', height: '100%' }, placeholder };
    const input  = type === 'number' ? <InputNumber {...options} /> : <Input {...options} />;
    return input;
  }
}

export default TextInput;
